package com.group.zsxm.web.action;

import java.util.HashMap;
import java.util.Map;

import org.apache.struts2.config.ParentPackage;
import org.apache.struts2.config.Result;
import org.apache.struts2.config.Results;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import net.sf.json.JSONObject;

import com.group.core.Constants;
import com.group.zsxm.entity.Xtuser;
import com.group.zsxm.service.XxglService;
import com.group.zsxm.web.common.BaseAction;

@ParentPackage("appDefault")
@Scope("prototype")
@Controller
@Results( {
			@Result(name = "showXxzg", value = "/WEB-INF/jsp/xxgl/showXxzg.jsp")
		})
public class XxglAction extends BaseAction{
	
	@Autowired
	@Qualifier("xxglService")
	private XxglService xxglService;
	private Map<String,String> parMap;
	private Xtuser xtuser;
	public void onPrepare(){
		xtuser = (Xtuser)getSession().getAttribute(Constants.USER_SESSION_KEY);
	} 
	
    //首页内容
    @SuppressWarnings("unchecked")
	public void doQueryIndex(){
    	Map mapOut = new HashMap();
		mapOut.put("xxzgList",xxglService.getIndexListByLx("10"));
		renderText(JSONObject.fromMap(mapOut).toString());
    
    }
    @SuppressWarnings("unchecked")
	public String doShowXxzg(){
    	parMap = xxglService.queryXxzg(parMap.get("xxid").toString());
    	return "showXxzg";
    }
    
    
    @SuppressWarnings("unchecked")
	public void doShowFj(){
    	Map m = new HashMap();
    	m.put("fjList", xxglService.queryFj(parMap.get("xxid").toString()));
		renderText(JSONObject.fromMap(m).toString());
    }
    /**
     * Mapping
     * @return
     */
	public XxglService getXxglService() {
		return xxglService;
	}

	public void setXxglService(XxglService xxglService) {
		this.xxglService = xxglService;
	}

	public Xtuser getXtuser() {
		return xtuser;
	}

	public void setXtuser(Xtuser xtuser) {
		this.xtuser = xtuser;
	}

	public Map<String, String> getParMap() {
		return parMap;
	}

	public void setParMap(Map<String, String> parMap) {
		this.parMap = parMap;
	}
}
